Page({
  data:{
   height:null,
   weight:null,
   gender:null,
   bmi:'',
   info:'',
   items: [
    {name: 'male', value: '男'},
    {name: 'famale', value: '女', checked: 'true'},
    ],
  },
  heightInput(e){
    this.setData({
      height: e.detail.value
  })
},
  weightInput(e){
    this.setData({
      weight:e.detail.value
    })
  },
  radioChange(e){
    console.log( e );
    this.setData({gender:e.detail.value});
  },
  bmi:function(event){
    var weightnum=parseFloat(this.data.weight)
    var heightnum=parseFloat(this.data.height)
    var gender =  this.data.gender;
    // var radioChange = this.data.radioChange
    var bmi = (weightnum/(heightnum/100)/(heightnum/100)).toFixed(2);
    var info=""
    if(gender=="male"){
      if(bmi<18.5){
        info="过轻，加强营养！"
      }else if(bmi>=18.5&&bmi<23.9){
        info="正常，继续保持！"
      }else if(bmi>=23.9&&bmi<27.9){
        info="超重，加强锻炼!"
      }else if(bmi>=27.9){
        info="有点胖了哦，提高警惕！"
      }
    }else{
      if(bmi<18.5){
        info="过轻，加强营养！"
      }else if(bmi>=18.5&&bmi<23.9){
        info="正常，继续保持！"
      }else if(bmi>=23.9&&bmi<27.9){
        info="超重，加强锻炼!"
      }else if(bmi>=27.9){
        info="有点胖了哦，提高警惕！"
      }
    }
    this.setData({
      bmi:bmi,
      info:info
    })
  }
})